home *** CD-ROM | disk | FTP | other *** search
- Path: news.shentel.net!Global-PPP
- From: scicom@globalcom.net (stephen j beaver)
- Newsgroups: comp.lang.c
- Subject: Re: Basic Question on SWITCH
- Date: Wed, 24 Jan 96 16:16:18 GMT
- Organization: scicom research us inc
- Distribution: world
- Message-ID: <4e5mc5$6oq@head.globalcom.net>
- References: <4e4cu4$95f@vixen.cso.uiuc.edu>
- NNTP-Posting-Host: eb3ppp13.shentel.net
- X-Newsreader: News Xpress Version 1.0 Beta #2
-
- HOTARD <jhotard> wrote:
- >I am just learning how to program in C, and I had a question about switch.
- >I am writing a program that looks at a character and then determines if it is a
- >letter or number. This program must use the switch command , can I place a
- >range on the case command somehow??
- >
- >ie: Switch (var)
- > case 0-9:
- >
- >or case (isdigit):
- >
- >would anything like this work???
- >
- >Thanks in advance
- >
- >Justin
- >
- The usual method would be:
-
- switch(var)
- {
- case 0 :
- case 1 :
- case 2 :
- case 3 :
- case 4 :
- case 5 : do_stuff();
- some_more();
- break;
- default :
- }
-
- steve
-
-